package com.example.springboot.controller;

import com.example.demo.pojo.VO.ListVO;
import com.example.demo.pojo.dto.DeviceDTO;
import com.example.demo.pojo.entity.Result;
import com.example.demo.service.ElectricityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ElectricityController {

    @Autowired
    private ElectricityService electricityService;

    @PostMapping("/electricity")
    public Result<ListVO> getElectricity(@RequestBody DeviceDTO deviceDTO){

        ListVO listVO = electricityService.getValue(deviceDTO);
        return Result.success(listVO);
    }
}
